import { privateRequest } from '@/utils/request';
import type { IVerifyParams, IVerifyInfo, IMergeParams } from './type';

enum API {
	// 文件是否存在
	Verify = '/upload/verify',
	// 文件上传
	Upload = '/upload/upload',
	// 文件合并
	Merge = '/upload/merge',
}

export const useUpload = (data: FormData) => {
	// 创建一个配置对象，指定请求头
	const headers = {
		'Content-Type': 'multipart/form-data',
	};
	return privateRequest.special({
		url: API.Upload,
		method: 'POST',
		data,
		headers,
	});
};
export const useVerify = (data: IVerifyParams) => privateRequest.post<IVerifyInfo>(API.Verify, data);
export const useMerge = (data: IMergeParams) => privateRequest.post<string>(API.Merge, data);
